Repository navigation
Read @BIN16@ weight blocks: half floats in .bin models - #43
Closed
ChinChangYang wants to merge 1 commit into
Closed
ChinChangYang wants to merge 1 commit into
ChinChangYang wants to merge 1 commit into
Conversation
A binary model's float block may now be "@bin16@" followed by its count of IEEE 754 half floats, little-endian, which desc.cpp's readFloats and katagocoreml's parser widen to 32 bits as they read (exactly: every half is a float). An "@bin@" block reads as before. AuroraGo ships its two networks with their convolution and matrix weights rewritten so (ChinChangYang/AuroraGo#92): half the bytes, and the MLX backend runs those weights in fp16 anyway. The batch norms and biases stay in "@bin@" blocks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A
.binmodel's float block can only be@BIN@and 32-bit floats, though gzip barely compresses them and every GPU backend that runs in fp16 casts the weights down as it builds the model. AuroraGo ships two b18c384 networks in its app and wants them half the size (ChinChangYang/AuroraGo#92).A float block may now also be
@BIN16@followed by its count of IEEE 754 half floats, little-endian.desc.cpp'sreadFloatsandkatagocoreml's parser read either marker and widen a half block to 32 bits exactly, so nothing after the loader changes; an@BIN@block reads as before, byte for byte.AuroraGo rewrites only the convolution and matrix multiply blocks (99.6 % of the floats), keeping the batch norms and biases at 32 bits: 97.9 + 99.1 MB → 49.0 + 49.7 MB. Over 318 positions from real games (
kata-raw-nn 0, MLX backend in fp16), the main network's win rate moved by 0.021 percentage points on average (0.27 at most) and its score lead by 0.013 points (0.10 at most), about what two builds of the MLX backend differ by on the same 32-bit file; throughkatagocoremlon the Neural Engine (FLOAT16) the two files give bit-identical outputs.Two files, +106 −15. Checked with the MLX build of AuroraGo's corpus engine, where the same hunks are applied (GPU and the ANE mux); AuroraGo vendors the
desc.cpphunks into itsEngine/as for #32 and #42.🤖 Generated with Claude Code